<template>
  <div class="reg-exp clearfix">
    <el-scrollbar style="height: 100%">
    <div class="main">
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">只能输入数字</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/[^\d]/g,’')
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">不能输入汉字</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/[\u4E00-\u9FA5]/ig,’')
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">只能输入字母和数字</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/[^\w]/ig,'')
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">去掉所有空格</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/\s/g,”")
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">只能输入数字和/</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/[^\d\/]/ig,'')
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">金钱数字三位分隔符</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            replace(/\B(?=(\d{3})+(?!\d))/g, ",")
          </code>
        </div>
      </el-card>
    </div>
    </el-scrollbar>
  </div>
</template>

<script>
export default {
  name: 'RegExp'
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
.reg-exp{
  margin: 0 auto;
  overflow: hidden;
  .main{
    column-count: 2;
    column-gap:10px;
    padding: 10px;
  }
  .el-card{
    margin: 10px 0;
  }
  .el-card__header{
    padding: 0 10px;
    text-align: left;
    font-size: 14px;
    line-height: 30px;
    line-height: 30px;
  }
}
</style>
